package com.wf.day_0531.test6;

/**
 * @author mpk
 * @since 2024/5/31 18:07:28
 */
public class TreeNodeDemo {
    public static void main(String[] args) {

        TreeNode treeNode = new TreeNode(1, null, null);
        TreeNode treeNode1 = new TreeNode(2, null, null);
        TreeNode treeNode2 = new TreeNode(3, null, null);
        TreeNode treeNode3 = new TreeNode(4, null, null);
        TreeNode treeNode4 = new TreeNode(5, null, null);
        TreeNode treeNode5 = new TreeNode(6, null, null);
        TreeNode treeNode6 = new TreeNode(7, null, null);

        treeNode.setLeft( treeNode1);
        treeNode.setRight(treeNode2);
        treeNode1.setLeft(treeNode3);
        treeNode1.setRight(treeNode4);
        treeNode2.setLeft(treeNode5);
        treeNode2.setRight(treeNode6);
        System.out.println("--前序---");
        treeNode.preForeach();
        System.out.println("--中序---");
        treeNode.midForeach();
        System.out.println("--后序---");
        treeNode.postForeach();

    }


}
